package hxy.bytecode.classload;
import	java.io.InputStream;

import java.lang.ClassLoader;
/**
 * @author eric
 * @description: 类加载器研究，主要是用于配置文件加载研究
 * @date 11/20/19 2:46 PM
 */
public class LocalThreadClassLoad {
    public static void main(String[] args) {
        ClassLoader classLoader =  Thread.currentThread().getContextClassLoader();
        System.out.println(classLoader);

        ClassLoader classLoader1 = LocalThreadClassLoad.class.getClassLoader();
        System.out.println(classLoader1);

        ClassLoader systemClassLoader = null;

            try {
                systemClassLoader = ClassLoader.getSystemClassLoader();
            } catch (SecurityException ignored) {
            }
        System.out.println(systemClassLoader);

//        在rexdb框架里面 加载是为了确认类的位置，用于加载配置文件的。
        InputStream is = classLoader.getResourceAsStream("rexdb.xml");

        if (is ==null)
        {
            InputStream is1 = classLoader.getResourceAsStream("/rexdb.xml");
            if (is1 == null){
                System.out.println("再次加载成功");
            }else {
                System.out.println("全部加载失败");
            }
        }else
        {
            System.out.println("加载成功");
        }


    }
}
